@include('public.page_styles')
<link rel="stylesheet" href="{{ asset("/AdminLTE/bower_components/bootstrap-daterangepicker/daterangepicker.css") }}">
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
@include('public.top')
  <!-- Left side column. contains the logo and sidebar -->
@include('public.sidebar')
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        {{ trans('message.activity') }}
        <small>{{ trans('message.add') }}</small>
      </h1>
      <ol class="breadcrumb">
        <li><a ><i class="fa fa-dashboard"></i> {{ trans('message.home') }}</a></li>
        <li><a href="{{ url('activity/list') }}"> {{ trans('message.activity') }} {{ trans('message.list') }}</a></li>
        <li class="active">{{ trans('message.activity') }}{{ trans('message.add') }}</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-md-12">
          <!-- Horizontal Form -->
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title"> {{ trans('message.add') }}</h3>
              <div class="box-tools">
                <div class="btn-group pull-right" style="margin-right: 10px">
                  <a href="{{ url('activity/list') }}" class="btn btn-sm btn-default"><i class="fa fa-list"></i>&nbsp; {{ trans('message.list') }}</a>
                </div>
                <div class="btn-group pull-right" style="margin-right: 10px">
                  <a class="btn btn-sm btn-default form-history-back" onclick="goBack()" ><i class="fa fa-arrow-left"></i>&nbsp;{{ trans('message.history-back') }}</a>
                </div>
              </div>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form name="createForm" action="{{url('activity/')}}" method="post"  class="form-horizontal"  >
              <input type="hidden" name="_token" value="{{ csrf_token() }}">
              <div class="box-body">
              <div class="form-group {!! !$errors->has('activity_name') ?: 'has-error' !!}">
                  <label for="activity_name" class="col-sm-2 control-label">活动名称</label>
                  <div class="col-sm-8">
                      <span class="form-control-require">*</span>
                      <input type="text" class="form-control" id="activity_name" name="activity_name" placeholder="活动名称" value="{{ old('activity_name') }}"   required autofocus>
                      @if($errors->has('activity_name'))
                          @foreach($errors->get('activity_name') as $message)
                              <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                          @endforeach
                      @endif
                  </div>
              </div>

            <div class="form-group {!! !$errors->has('activity_dec') ?: 'has-error' !!}">
              <label for="activity_dec" class="col-sm-2 control-label">活动描述</label>
              <div class="col-sm-8">
                <input type="text" class="form-control" id="activity_dec" name="activity_dec" placeholder="描述" value="{{ old('activity_dec') }}"  >
              </div>
            </div>

              <div class="form-group">
                  <label for="remark" class="col-sm-2 control-label">备注</label>
                  <div class="col-sm-8">
                      <input type="text" class="form-control" id="remark" name="remark" placeholder="" value="{{ old('remark') }}"  >
                  </div>
              </div>

              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <div class="col-sm-2">
                </div>
                <div class="col-sm-8">
                  <div class="btn-group pull-right">
                    <button type="button" class="btn btn-info pull-right btn-js-form-submit" >提交</button>
                  </div>
                  <div class="btn-group pull-left">
                    <button type="reset" class="btn btn-warning">撤销</button>
                  </div>
                </div>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
          <!-- /.box -->
        </div>
        <!--/.col (right) -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>
  <!-- /.content-wrapper -->
@include('public.bottom')

  <!-- Control Sidebar -->
{{--@include('public.aside')--}}
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

@include('public.javascript')
{{--<script src="{{ asset ("/AdminLTE/bower_components/fastclick/lib/fastclick.js") }}" type="text/javascript"></script>--}}
<script src="{{ asset ("/AdminLTE/bower_components/moment/min/moment.min.js") }}" type="text/javascript"></script>
<script src="{{ asset ("/AdminLTE/bower_components/bootstrap-daterangepicker/daterangepicker.js") }}" type="text/javascript"></script>


<script type="text/javascript">
    $(function(){
        $('#reportrange').daterangepicker({
            showDropdowns : true,
            showWeekNumbers : false, //是否显示第几周
            buttonClasses : [ 'btn btn-default' ],
            applyClass : 'btn-small btn-primary blue',
            cancelClass : 'btn-small',
            format : 'YYYY-MM-DD', //控件中from和to 显示的日期格式
            separator : ' to ',
            locale : {
                applyLabel : '确定',
                cancelLabel : '取消',
                fromLabel : '起始时间',
                toLabel : '结束时间',
                customRangeLabel : '自定义',
                daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
                monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月',
                    '七月', '八月', '九月', '十月', '十一月', '十二月' ],
                firstDay : 1
            }
            }, function(start, end, label) {//格式化日期显示框

            $('#reportrange input').val(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD'));
        });

    });



jQuery(function ($) {
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': '{{ csrf_token() }}'
        }
    });


    @if(session()->has('fail'))
      alertMess("{{session()->get('fail')}}");
    @endif


});

    var _ajaxSubmitSending = false;
    $(".btn-js-form-submit").click(function (e) {
        if (_ajaxSubmitSending) {
            return;
        } else {
            _ajaxSubmitSending = true;
            _loadingFuc();
        }
        $('form[name="createForm"]').submit();
        _ajaxSubmitSending = false;
        setTimeout(function(){
            $.unblockUI();
        }, 1500);
    });



</script>

</body>
</html>
